home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 016 / 29rows.arc / 29ROWS.ASM next >
Encoding:
Assembly Source File  |  1986-10-27  |  5.6 KB  |  268 lines

  1. ;--------------------------------------------------------------------------
  2. ;
  3. ;   29ROWS.ASM, v1.0, Peter Nelson.  This program sets the 6845 chip in
  4. ;   the CGA card to 29 rows.  (It isn't difficult to set it to 90 columns,
  5. ;   but no programs are compatible with it besides DOS.)  The program 
  6. ;   then saves the interrupt vector for IL-10xH in memory, and redirects
  7. ;   the IL-10xH vector to point to my routine.  The interrupt routine checks
  8. ;   to see if the WRITE_TTY call is being used, and if not, flow is passed
  9. ;   to the normal BIOS routines.  If so, then I take over, and only scroll
  10. ;   after 29 lines, instead of 25.  This program was compiled using Eric
  11. ;   Isaacson's A86 compiler.  If you read the code, you will find a small
  12. ;   bug of the compiler.  It ignored the FAR designation in my JMP command
  13. ;   and I was forced to put the code in directly.  Still, it's the best
  14. ;   compiler for the money (ShareWare).  If you like this program, please
  15. ;   don't bother sending any money.  You and I both know it isn't worth
  16. ;   anything.  Finis, Mongo.
  17. ;
  18. ;   Note:  This program remains resident in memory and occupies 704 bytes.
  19. ;
  20.  
  21.  
  22.  
  23. ACTIVE_PAGE EQU    040:0062xH    ; Video data area
  24. CRT_COLS    EQU    040:004AxH    ; Video data area
  25. CRT_MODE    EQU    040:0049xH    ; Video data area
  26.  
  27.  
  28. INT_PRINT  EQU    INT 017h     ; BIOS interrupt to print to printer
  29. INT_SCREEN EQU    INT 010h    ; BIOS interrupt for screen functions
  30. TIMER       EQU    040h        ; Used by BEEP routine
  31. PORT_B       EQU    061h        ; Used by BEEP routine
  32. BELL       EQU  07h        ; Bell character for screen
  33. BKSP       EQU    08h        ; Backspace character for screen
  34. CR       EQU    0Dh        ; Carriage return char for printer
  35. LF       EQU    0Ah        ; Line feed char for printer
  36. FF       EQU    0Ch        ; Form feed char for printer
  37. MSDOS       EQU    INT 021xH    ; DOS software interrupt
  38. TTY       EQU    0ExH        ; BIOS 10h Interrupt indicates tty_write
  39.  
  40.  
  41.  
  42. START:    JMP    PROGRAM
  43.  
  44.  
  45. INT10VECTOR    DW    ????
  46. INT10VECTOR2    DW    ????
  47. SCREENLEN    DB    28xD
  48. CREATOR        DB    '29ROWS, v1.0, by Peter Nelson.  Hi there!'
  49.  
  50.  
  51. PROGRAM:
  52.     MOV    DX, 03D4xH        ; Set up the 6845 graphics chip
  53.     MOV    AL, 06
  54.     OUT    DX, AL
  55.     INC    DX
  56.     MOV    AL, [SCREENLEN]
  57.     INC    AL
  58.     OUT    DX, AL
  59.     DEC    DX
  60.     MOV    AL, 07
  61.     OUT    DX, AL
  62.     INC    DX
  63.     MOV    AL, [SCREENLEN]
  64.     INC    AL
  65.     INC    AL
  66.     OUT    DX, AL
  67.  
  68.  
  69. SETVECTORS:
  70.     MOV    AH, 035xH
  71.     MOV    AL, 010xH
  72.     MSDOS
  73.     MOV    INT10VECTOR, BX
  74.     MOV    INT10VECTOR2, ES
  75.     
  76.     MOV    DS, CS                ; Redirect IL10h
  77.     MOV    DX, OFFSET INT10_OE        ; to the beginning of my
  78.     MOV    AH, 025xH            ; program       
  79.     MOV    AL, 010xH
  80.     MSDOS
  81.  
  82.     MOV    DX, OFFSET VERYEND
  83.     INT    027xH
  84.  
  85.  
  86.  
  87. ;--------------------------------------------------------------------------
  88. ;    Here is the start of the interrupt intercept routine
  89.  
  90. INT10_OE:
  91.     CMP    AH, TTY
  92.     IF NE JMP NOTMINE
  93.  
  94.     STI    
  95.     CLD
  96.     PUSH    AX, BP, BX, CX, DI, DS, DX, ES, SI
  97.     PUSHF
  98.  
  99.  
  100. WRITE_TTY:
  101. ;--------------------------------------------------------------------------
  102. ;    Here we save the registers
  103.  
  104.     PUSH    AX, DS
  105.  
  106. ;--------------------------------------------------------------------------
  107. ;    Here we must set the [DS] reg to point to the video area
  108.  
  109.     PUSH    AX
  110.     MOV    AX, 040xH
  111.     MOV    DS, AX
  112.     POP    AX
  113.  
  114. ;--------------------------------------------------------------------------
  115. ;    Here we get the cursor position
  116.  
  117.     PUSH    AX
  118.     MOV    AH, 3
  119.     MOV    BH, [ACTIVE_PAGE]
  120.     INT_SCREEN
  121.     POP    AX
  122.  
  123. ;--------------------------------------------------------------------------
  124. ;    [DX] now has the current cursor position
  125.     
  126.     CMP    AL, BKSP
  127.     JE    U8
  128.     CMP    AL, CR
  129.     JE    U9
  130.     CMP    AL, LF
  131.     JE    U10
  132.     CMP    AL, BELL
  133.     JE    U11
  134.  
  135. ;--------------------------------------------------------------------------
  136. ;     Write the character to the screen
  137.     
  138.     MOV    AH, 0AxH
  139.     MOV    CX, 1
  140.     INT_SCREEN
  141.  
  142. ;--------------------------------------------------------------------------
  143. ;    Position the cursort for next char
  144.  
  145.     INC    DL
  146.     CMP    DL, [CRT_COLS]
  147.     JNZ    U7
  148.     MOV    DL, 0
  149.     CS CMP    DH, [SCREENLEN]
  150.     JNZ    U6
  151.  
  152. ;--------------------------------------------------------------------------
  153. ;    Scroll Required
  154.  
  155. U1:
  156.     MOV    AH, 2
  157.     INT_SCREEN
  158.  
  159. ;--------------------------------------------------------------------------
  160. ;    Determine the value to fill with during scroll
  161.  
  162.     MOV    AL, [CRT_MODE]    
  163.     CMP    AL, 4
  164.     JC    U2
  165.     CMP    AL, 7
  166.     MOV    BH, 0
  167.     JNE    U3
  168.  
  169. U2:
  170.     MOV    AH, 8
  171.     INT_SCREEN
  172.     MOV    BH, AH
  173.  
  174. U3:
  175.     MOV    AX, 0601xH
  176.     SUB    CX, CX
  177.     CS MOV    DH, [SCREENLEN]
  178.     MOV    DL, [CRT_COLS]
  179.     DEC    DL
  180.  
  181. U4:
  182.     INT_SCREEN
  183.  
  184. U5:
  185.     POP    DS, AX
  186.     JMP    VIDEO_RETURN
  187.  
  188. U6:
  189.     INC    DH
  190.  
  191. U7:
  192.     MOV    AH, 2
  193.     JMP    U4
  194.  
  195. ;--------------------------------------------------------------------------
  196. ;    BackSpace Found
  197.  
  198. U8:
  199.     CMP    DL, 0
  200.     JE    U7
  201.     DEC    DL
  202.     JMP    U7
  203.  
  204. ;--------------------------------------------------------------------------
  205. ;    Carriage Return Found
  206.  
  207. U9:
  208.     MOV    DL, 0
  209.     JMP    U7
  210.  
  211. ;--------------------------------------------------------------------------
  212. ;    Line Feed Found    
  213.  
  214. U10:
  215.     CS CMP    DH, [SCREENLEN]
  216.     JNE    U6
  217.     JMP    U1
  218.  
  219. ;--------------------------------------------------------------------------
  220. ;    Bell Found
  221.  
  222. U11:
  223.     PUSH    AX, CX
  224.     MOV    AL, 10110110xB
  225.     OUT    TIMER+3, AL
  226.     MOV    AX, 0777h
  227.     OUT    TIMER+2, AL
  228.     MOV    AL, AH
  229.     OUT    TIMER+2, AL
  230.     IN    AL, PORT_B
  231.     MOV    AH, AL
  232.     OR    AL, 03h
  233.     OUT    PORT_B, AL
  234.     MOV    CX, 0000h
  235.     LOOP    $-1
  236.     MOV    AL, AH
  237.     OUT    PORT_B, AL
  238.     POP    CX, AX
  239.  
  240.     JMP    U5
  241.  
  242.  
  243. ;--------------------------------------------------------------------------
  244.  
  245.  
  246. EXIT:
  247. VIDEO_RETURN:
  248.     POPF
  249.     POP    SI, ES, DX, DS, DI, CX, BX, BP, AX
  250.  
  251.     IRET
  252.  
  253.  
  254.  
  255.  
  256. ;---------------------------------------------------------------------------
  257. NOTMINE:
  258.     DB    02ExH                ; Assembler bug, need to
  259. ;    CS:                    ; manually enter the code
  260.     DB    0FFxH, 02ExH, 03xH, 01xH    ; here.
  261. ;    JMP FAR [INT10VECTOR]            ;
  262. ;--------------------------------------------------------------------------
  263.  
  264.  
  265.  
  266.           DB    00xH
  267. VERYEND:
  268.